﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;

namespace EnergyConsumptionMonitorSystem.Models
{
    public class LogInStatus
    {
        public delegate void StatusChangedHandler(bool value);
        public event StatusChangedHandler StatusChangedEvent;

        private bool _status = false;
        public bool Status
        {
            get { return this._status; }
            private set
            {
                if (this._status != value)
                {
                    this._status = value;
                    if (this.StatusChangedEvent != null)
                    {
                        this.StatusChangedEvent(value);
                    }
                }
            }
        }

        public void LogIn(User user)
        {
            this.User = user;
            this.Status = true;           
        }

        public void LogOut()
        {
            this.User = null;
            this.Status = false;          
        }

        public User User { get; set; }

    }
}
